<include file="public@header"/>
</head>
<body>
<div class="layui-fluid js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('Setting/log_list')}">错误日志</a></li>
       
    </ul>
    <div class="row m-bottom-md">
        <div class="layui-col-xs6">
            <h2>{:lang('ADMIN_SETTING_LOG_LIST')}123</h2>
        </div>
    </div>

    <form class="well form-inline margin-top-20" method="post" action="{:url('Setting/log_list')}">
        <!-- <div class="layui-col-sm11 no-padding"> -->
        <input type="text" class="layui-input" name="keyword" style="width: 160px;"
               value="{$keyword|default=''}" placeholder="{:lang('PLEASE_ENTER_KEYWORD')}">
       &nbsp;&nbsp;
        类型:
        <select class="layui-input" name="err_level" style="width: 140px;">
            <option value='0' <if condition="$err_level eq 'error'">selected</if> >error</option>
            <option value='1' <if condition="$err_level eq 'debug'">selected</if> >debug</option>
            <option value='2' <if condition="$err_level eq 'notice'">selected</if> >notice</option>
            
        </select> &nbsp;&nbsp;

        
        时间:
        <input type="text" class="layui-input js-bootstrap-date" name="start_time"
               value="{$start_time|default=''}"
               style="width: 140px;" autocomplete="off">
        
        <input type="submit" class="layui-btn layui-btn-normal" value="{:lang('SEARCH')}"/>
        <a href="javascript:;" class="layui-btn layui-btn-danger layui-btn-sm"  id='daochu'>导出</a>

        <!-- </div> -->

    </form>


    <form class="js-ajax-form" action="" method="post">
        
        <table class="layui-table">
            <thead>
            <tr>
                <th width="20">
                    <label>
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </label>
                </th>
                
                <th width="">ID</th>
                <th style="width:95px;" width="95">时间</th>
                <th>类型</th>
                <th>错误日志</th>
                <th width="60">操作</th>
           
            </tr>
            </thead>
            <if condition="$data_list">
            <foreach name="data_list" item="vo">
                <tr>
                    <td>
                        <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                               value="{$key}" title="ID:{$key}">
                    </td>
                    
                    <td><b>{$key}</b></td>
                    <td>
                        {$start_time|default=''}
                    </td>
                    <td>{$err_level}</td>
                    <td>
                        {$vo}
                    </td>
                    
                    
                    <td>
                        <a href="javascript:;" del-id='{$key}' class='del' >删除</a>  
                        
                    </td>
                    
                </tr>

            </foreach>

            <else/>
                <tr>
                        <td colspan="6" style="text-align:center;">还没有相关记录！</td>
                </tr>

            </if>

            
        </table>
        
        <ul class="pagination">{$page|default=''}</ul>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>

    function reloadPage(win) {
        win.location.reload();
    }

    $(function () {
        setCookie("refersh_time", 0);
        Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {
            //批量复制
            $('.js-articles-copy').click(function (e) {
                var ids = [];
                $("input[name='ids[]']").each(function () {
                    if ($(this).is(':checked')) {
                        ids.push($(this).val());
                    }
                });

                if (ids.length == 0) {
                    art.dialog.through({
                        id: 'error',
                        icon: 'error',
                        content: '您没有勾选信息，无法进行操作！',
                        cancelVal: '关闭',
                        cancel: true
                    });
                    return false;
                }

                ids = ids.join(',');
                art.dialog.open(GV.ROOT + "portal/admin_article/copy?&ids=" + ids, {
                    title: "批量复制",
                    width: "300px"
                });
            });

            //批量移动
            $('.js-articles-move').click(function (e) {
                var ids = [];
                $("input[name='ids[]']").each(function () {
                    if ($(this).is(':checked')) {
                        ids.push($(this).val());
                    }
                });

                if (ids.length == 0) {
                    art.dialog.through({
                        id: 'error',
                        icon: 'error',
                        content: '您没有勾选信息，无法进行操作！',
                        cancelVal: '关闭',
                        cancel: true
                    });
                    return false;
                }

                ids = ids.join(',');
                art.dialog.open(GV.ROOT + "portal/admin_article/move?old_cat_id={$category|default=0}&ids=" + ids, {
                    title: "批量移动",
                    width: "300px"
                });
            });
        });
    });


    $('.del').click(function(){
      
        var key = $(this).attr('del-id');
        var err_level = $(".layui-input").find("option:selected").text();
        
        var d_time = $('.js-bootstrap-date').val();

        var $_this  = this,
            $this   = $($_this),
            href    = $this.data('href'),
            refresh = $this.data('refresh'),
            msg     = $this.data('msg');
        art.dialog({
            title: false,
            icon: 'question',
            content: msg ? msg : '确定要删除吗？',
            follow: $_this,
            close: function () {
                $_this.focus(); //关闭时让触发弹窗的元素获取焦点
                return true;
            },
            okVal: "确定",
            ok: function () {
                $.post('__URL__/del_is_ext',{'err_level':err_level,'d_time':d_time,'del_id':key},function(res){

                    if(res.status == 1){

                        alert(res.msg);
                        location.reload();

                    }else{
                        alert(res.msg);
                    }

                },'json');
            },
            cancelVal: '关闭',
            cancel: true
        });

        
        


    });


    $('#daochu').click(function(){

        var err_level = $(".layui-input").find("option:selected").text();
        
        var d_time = $('.js-bootstrap-date').val();

        var keyword = $('#keyword').val();

        
        $.post('__URL__/is_ext',{'err_level':err_level,'d_time':d_time,'keyword':keyword},function(res){

            if(res.status == 1){
                var file = res.file_url;
                var time = res.times;
                location.href="download/time/"+time+"/down_file/"+file;
            

            }else{
                alert(res.msg);
            }

        },'json');

    });

    $('#keyword').keyup(function(){

        var ss = $(this).val();

        reg=/[`~!@#$%^&*()_+<>?:"{},.\/;'[\]]/im;  


        if(reg.test(ss)){ //替换非数字字符 

            var temp_amount=ss.replace(reg,'');  

            $(this).val(temp_amount);  
        }

    });



</script>
</body>
</html>
